package com.heima.article.controller.v1;

import com.heima.article.service.ApAuthorService;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/author")
@Api(value = "app作者管理API",tags = "app作者管理API")
public class ApAuthorController {
    @Autowired
    private ApAuthorService apAuthorService;

    //根据ApUser id查询作者信息
    @ApiOperation("根据ApUser id查询作者信息")
    @GetMapping("/findByUserId/{id}")
    public ResponseResult findByUserId(@PathVariable("id") Integer id){
        return apAuthorService.findByUserId(id);
    }

    //保存作者信息
    @ApiOperation("保存作者信息")
    @PostMapping("/save")
    public ResponseResult save(@RequestBody ApAuthor apAuthor){
        return apAuthorService.insert(apAuthor);
    }
}
